<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui" xmlns:app="http://org.wsiz.vro/app"
	contentType="text/html" encoding="UTF-8">
	<html xmlns="http://www.w3.org/1999/xhtml"
		xml:lang="${userContext.locale}" lang="${userContext.locale}">
<h:head>
	<f:facet name="first">
		<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
		<title>${empty title? msg.main_title : title}</title>
	</f:facet>
	<f:facet name="last">
		<h:outputStylesheet name="css/main.css" />
		<h:outputScript name="js/main.js" />
	</f:facet>
</h:head>
<h:body>
	<h:form id="form">
		<!-- regular layout (does not work with chromeshades :-( ) -->
		<p:layout fullPage="true">

			<p:layoutUnit id="top" position="north" resizable="false" size="115">

				<div role="banner">
					<h:panelGrid columns="3" style="width: 100%">

						<h1 style="text-align: center;">${empty title? msg.main_title
							: title}</h1>
						<h:panelGroup>
							<div style="float: right;">
								<h:outputFormat rendered="#{!userContext.isAnonymousUser()}"
									value="${userContext.username}" style="margin-right: 5px;" />
								<h:outputLink id="login_link"
									value="${facesContext.externalContext.requestContextPath}/app/login"
									styleClass="userInfo-user"
									rendered="${userContext.isAnonymousUser()}">
									<h:outputText value="${msg.connexion}" />
								</h:outputLink>
								<h:outputLink id="logout_link"
									value="${facesContext.externalContext.requestContextPath}/app/logout"
									styleClass="userInfo-user"
									rendered="${not userContext.isAnonymousUser()}">
									<h:outputText value="${msg.logout}" />
								</h:outputLink>
								<a id="home_link"
									href="${facesContext.externalContext.requestContextPath}/app/home"
									class="userInfo-welcome">${msg.home}</a>
								<h:outputLink value="home?locale=pl" styleClass="userInfo-fr"
									rendered="#{!(userContext.locale eq 'pl')}">Polish</h:outputLink>
								<h:outputLink value="home?locale=en" styleClass="userInfo-en"
									rendered="#{userContext.locale eq 'pl'}">English</h:outputLink>
							</div>
						</h:panelGroup>
					</h:panelGrid>
				</div>
				<div role="navigation">
					<ui:insert name="topmenu">
					</ui:insert>
				</div>
			</p:layoutUnit>

			<p:layoutUnit id="center" position="center">
				<ui:insert name="center" />
			</p:layoutUnit>

		</p:layout>


		<p:dialog widgetVar="askForDeleteDialog" modal="true" header="Delete?"
			height="120" width="300">
			<p>
				<h:outputText value="${msg.dialog_delete_confirm}" />
			</p>
			<br />
			<p:commandButton id="askForDeleteDialogYes" action="deleteAndClose"
				ajax="false" immediate="true" process="@none" value="${msg.yes}"
				title="${msg.dialog_delete_confirm} ${msg.yes}" icon="ui-icon-check" />
			<p:commandButton id="askForDeleteDialogNo" value="${msg.no}"
				title="${msg.dialog_delete_confirm} ${msg.no}"
				onclick="askForDeleteDialog.hide(); APP.focusTo('form:delete'); return false;"
				icon="ui-icon-cancel" />
		</p:dialog>


		<p:dialog widgetVar="askForSaveDialog" modal="true" header="Save?"
			height="120" width="300">
			<p>
				<h:outputText value="${msg.dialog_ask_for_save}" />
			</p>
			<br />
			<p:commandButton id="askForSaveDialogYes" action="saveAndClose"
				ajax="true" process="@form" value="${msg.yes}"
				title="${msg.dialog_ask_for_save} ${msg.yes}"
				onstart="askForSaveDialog.hide()" styleClass="aria-save-button"
				update="messages" icon="ui-icon-check" />
			<p:commandButton id="askForSaveDialogNo" action="forceClose"
				ajax="false" value="${msg.no}"
				title="${msg.dialog_ask_for_save} ${msg.no}" icon="ui-icon-cancel"
				immediate="true" process="@none" />
		</p:dialog>
	</h:form>
	<script type="text/javascript">
			// example with asynchronous google analytics
			var _gaq = _gaq || [];
			_gaq.push([ '_setAccount', 'UA-166864-24' ]); // change with your google id
			_gaq.push([ '_setCustomVar', 1, 'rootPackage', 'jsf2Prime_org.wsiz.vro', 1 ]); // example of user defined variable
			_gaq.push([ '_trackPageview' ]);
	
			(function() {
				var ga = document.createElement('script');
				ga.type = 'text/javascript';
				ga.async = true;
				ga.src = ('https:' == document.location.protocol ? 'https://ssl'
						: 'http://www')
						+ '.google-analytics.com/ga.js';
				var s = document.getElementsByTagName('script')[0];
				s.parentNode.insertBefore(ga, s);
			})();
		</script>
</h:body>
	</html>
</f:view>